import 'package:shining_red_star/model/unique.dart';

class ShapeGroup {
  final String id;
  final String title;

  const ShapeGroup({
    required this.id,
    required this.title,
  });

  factory ShapeGroup.fromJson(Map<String, dynamic> json) {
    return ShapeGroup(
      id: json['id'],
      title: json['title'],
    );
  }

  static List<ShapeGroup> jsonToList(List<dynamic> json) {
    return json.map((item) => ShapeGroup.fromJson(item)).toList();
  }
}

class ShapeInfo implements Unique {
  @override
  final String id;
  final String value;
  final String fillColor;
  final String pinYin;
  final String aud;
  final List<String> group;

  const ShapeInfo({
    required this.id,
    required this.value,
    required this.fillColor,
    required this.pinYin,
    required this.aud,
    required this.group,
  });

  factory ShapeInfo.fromJson(Map<String, dynamic> json) {
    return ShapeInfo(
      id: json['id'],
      value: json['value'],
      fillColor: json['fillColor'],
      pinYin: json['pinYin'],
      aud: json['aud'],
      group: List.from(json['group']),
    );
  }

  static List<ShapeInfo> jsonToList(List<dynamic> json) {
    return json.map((item) => ShapeInfo.fromJson(item)).toList();
  }
}
